* FILE NAME : CASH406.PRG
* Thien created on 19 Oct 2010 to allow search first 3 chars of dispo item
* ************************************************************************
STORE 0 TO CNT,CR
play=savescreen(0,0,24,79)
nLen=len(alltrim(dispin))
DO WHILE dispk=SPACE(5) .AND. LASTKEY()<>27
  STORE 0 TO CNT,CR
  SELE 10
  SET EXCLU OFF
  use &dr&f10 INDEX &DR&F10A
*  GO TOP
  seek ALLTRIM(DISPIN)
*  if .not. eof()
  DO WHILE left(disp_name,len(DISPIN))=alltrim(DISPIN)
    IF FOR_SALE .and. sale_price>0 .and. FOR_SOS
      CNT=CNT+1
    ENDIF
    skip
  ENDDO
  IF CNT=0
    RETURN
  ENDIF
  DECLARE FLD[CNT]
  DECLARE KDP[CNT]
  DECLARE NME[CNT]
*  SELE 10
*  GO TOP
  seek ALLTRIM(DISPIN)
*  if .not. eof()
  DO WHILE left(disp_name,len(DISPIN))=alltrim(DISPIN)
  * Buu 13-05-2004 : Not show if for_sale = false
    IF FOR_SALE .and. sale_price>0 .and. FOR_SOS
      CR=CR+1
      nm=alltrim(disp_name)+' '+alltrim(disp_type)+' '+alltrim(disp_qant)+' '+alltrim(disp_unit)
      FLD[CR]=subs(NM,1,55)+space(55-len(nm))+disp_Code
      KDP[CR]=disp_CODE
      NME[CR]=disp_name
  	ENDIF
  * Buu 13-05-2004 End
    SKIP
  ENDDO
*endif
  set colo to w/b
  inkey()
  set colo to w+/rb,gr+/r
  @ 15,3 clea to 22,75
  @ 15,3 to 22,75 double
  pilih=achoice(16,5,21,73,FLD)
  IF LASTKEY()=13
    FILD=FLD[PILIH]
    dispK=KDP[PILIH]
    NAME=NME[PILIH]
  ELSE
    restscreen(0,0,24,79,play)
  *      close database
  *      close index
  *      set color to n/bg/w+/n
    return
  ENDIF
*  else
*     name=space(32)
*  endif
enddo